#录入指纹存于imageBuffer
import serial
import string
import binascii
import time

s=serial.Serial('/dev/ttyUSB0',115200)
GetImage=[0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05]
print("GetImage")
while True:
    s.write(GetImage)
    time.sleep(1)
    number=s.inWaiting()
    read= str(binascii.b2a_hex(s.read(number)))[2:-1]
    if read[19]=='0':
        print("指纹收集成功")
        break
    else:
        print("指纹收集失败")
s.close()
